# hash:sha256:66fbd44f794e7be3fbc52dd633cf4a0b62bdea13ecda2edcdcba52a40e2ca744
FROM registry.codeocean.com/codeocean/r-base:3.6.0-ubuntu18.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
    && apt-get install -y --no-install-recommends software-properties-common \
    && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys \
        0xAD2323F17326AE31401037733E05EBFF05441C52 \
    && add-apt-repository -y 'deb http://deb.codeocean.com/rstudio-server-bionic/ ubuntu main' \
    && apt-get purge -y --autoremove software-properties-common \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
        libgdal-dev=2.2.3+dfsg-2 \
        pandoc=1.19.2.4~dfsg-1build4 \
        rstudio-server=1.2.5019 \
    && rm -rf /var/lib/apt/lists/*

RUN Rscript -e 'remotes::install_version("MASS", version = "7.3-51.4")' \
    && Rscript -e 'remotes::install_version("doParallel", version = "1.0.15")' \
    && Rscript -e 'remotes::install_version("foreach", version = "1.4.7")' \
    && Rscript -e 'remotes::install_version("haven", version = "2.2.0")' \
    && Rscript -e 'remotes::install_version("here", version = "0.1")' \
    && Rscript -e 'remotes::install_version("purrr", version = "0.3.3")' \
    && Rscript -e 'remotes::install_version("sf", version = "0.8-0")' \
    && Rscript -e 'remotes::install_version("sp", version = "1.3-2")' \
    && Rscript -e 'remotes::install_version("spatialreg", version = "1.1-3")' \
    && Rscript -e 'remotes::install_version("spdep", version = "1.1-3")' \
    && Rscript -e 'remotes::install_version("tictoc", version = "1.0")' \
    && Rscript -e 'remotes::install_version("tidyverse", version = "1.2.1")' \
    && Rscript -e 'remotes::install_version("xtable", version = "1.8-4")'
